import request from '@/utils/request'

export async function getNews(data) {
  return request({
    url: "/adminSever/newsBg/get",
    method: "POST",
    data
  })
}

export async function createNewsInfo() {
  return await request({
    url: '/adminSever/newsBg/save',
    method: 'GET'
  })
}

export async function getNewsInfoById(id) {
  return await request({
    url: `/adminSever/newsBg/get/${id}`,
    method: 'GET'
  })
}

export async function removeNewsById(data) {
  return await request({
    url: `/adminSever/newsBg/remove`,
    method: 'DELETE',
    data
  })
}

export async function uploadContentPhoto(data) {
  return request({
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url: `/adminSever/newsBg/content-photo/${data.id}`,
    data: {
      file: data.file
    },
    method: "POST"
  })
}

export async function saveNewsInfo(data) {
  return await request({
    url: `/adminSever/newsBg/save-content`,
    method: 'POST',
    data
  })
}
export async function changeState(data) {
  return await request({
    url: `/adminSever/newsBg/change-state`,
    method: 'PUT',
    data
  })
}

export async function getPreviewNewsContent(id) {
  return await request({
    url: `/adminSever/newsBg/preview-content/${id}`,
    method: 'GET'
  })
}



